package wpmp.security.mgr.base;

import org.apache.commons.lang3.ArrayUtils;

import com.alibaba.fastjson.JSON;

/**
 * 所有Entity的抽象基类
 * 
 * @author Wayne.Wang<5waynewang@gmail.com>
 * @since 10:44:38 AM Dec 21, 2012
 */
public abstract class BaseEntity implements java.io.Serializable, SysUserMgr, RequestMgr {

	private static final long serialVersionUID = 1L;

	private String sysLoginName; // 当前系统登录人员的登录名称
	private String remoteAddr; // 请求的远程地址

	@Override
	public String getRemoteAddr() {
		return remoteAddr;
	}

	@Override
	public void setRemoteAddr(String remoteAddr) {
		this.remoteAddr = remoteAddr;
	}

	@Override
	public String getSysLoginName() {
		return sysLoginName;
	}

	@Override
	public void setSysLoginName(String sysLoginName) {
		this.sysLoginName = sysLoginName;
	}

	/**
	 * toString不需要输出的属性名称，默认为空，子类可重写此方法。防止日志输出导致信息泄漏
	 * 
	 * @return
	 */
	protected String[] excludeFieldNames() {
		return ArrayUtils.EMPTY_STRING_ARRAY;
	}

	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}
}
